package top.yzhao.trackdatasystem.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import top.yzhao.trackdatasystem.model.Log;

import java.util.List;

/**
 * User: zhaoyang
 * Date: 2020/3/13
 * Time: 14:04
 * Description: No Description
 */
@Repository
@Mapper
public interface LogDao {

    @Insert("Insert into Log (username,operate,op_time,ip_address) values " +
            " (#{username},#{operate},#{op_time},#{ip_address})")
    public int addLog(Log log);

    @Select("select * from Log Log where username like concat(concat('%',#{query}),'%') limit #{current},#{pageSize}")
    public List<Log> getLogList(@Param("query") String query,
                                     @Param("current") int current,
                                     @Param("pageSize") int pageSize);

    @Select("Select count(*) from Log")
    public int getTotalLogList();

}
